package com.example.design.bilibili.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * 学院
 */
public class College extends OrganizationComponent{

    //List中存放的Department
    List<OrganizationComponent> organizationComponentList = new ArrayList<>();

    public College(String name, String desc) {
        super(name, desc);
    }

    //实际业务中的College和University的add方法实现不一定一样
    @Override
    protected void add(OrganizationComponent organizationComponent) {

        organizationComponentList.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        organizationComponentList.remove(organizationComponent);
    }

    @Override
    protected void print() {
        System.out.println("========="+getName()+"============");
        for(OrganizationComponent component:organizationComponentList){
            component.print();
        }
    }

    @Override
    public String getName() {
        return super.getName();
    }

    @Override
    public String getDesc() {
        return super.getDesc();
    }
}
